
var  strUrlHost="http://211.140.17.102:7080/monitor/service";

function initUserInfor(){
	var host =addMethod(strUrlHost,"userinfo");
	host =addToken(host);
	console.log("host:"+host);
	requestUserInfor(host);
}

function addMethod(host,method){
	return host+"?method="+method;
}

function addToken(host){
	var token= window.localStorage.getItem("accessToken");	
	return host+"&access_token="+token;
}

function requestUserInfor(requestUrl){
	$.ajax({
		type:"post",
		url:requestUrl,
		success:function(resultData){
			var flag = resultData.success;			
			if(flag==1){
				var userInfor=resultData.userInfo;				
				if(userInfor!=undefined&&userInfor!=null){
					document.getElementById("id-span-account").innerHTML=userInfor.moble;
				}
			}
			
		}
	});
}

function doExitRequest(){
	var requestUrl= addMethod(strUrlHost,"loginout");
	requestUrl=addToken(requestUrl);
	console.log("requestUrl:"+requestUrl);
	$.ajax({
		type:"post",
		url:requestUrl,
		success:function(result){
			var flag = result.success;
			if(flag==1){				
				console.log("exist success");
			}
		}
	});
}

function onResetPassword(){
	window.location.href="ResetPassword.html";
}

function onAbout(){
	window.location.href="About.html";
}

function showDialog(){
	document.getElementById("id-dialog").style.display='block';
	//$("#id-dialog").show();
	//.
	document.getElementById("id-dialog").style.opacity=1;  	
}

function dismissDialog(){
	document.getElementById("id-dialog").style.display='none';
	document.getElementById("id-dialog").style.opacity=0; 
}

function onExit(){
	showDialog();
}

function onOK(){	
	dismissDialog();
	doExitRequest();
	window.location.href="Login.html";
}

function onCancle(){	
	dismissDialog();
	window.location.href="Moniter.html";
}
